Realm List K Serializer
class RealmListKSerializer<E>(elementSerializer: KSerializer <E>) : KSerializer <RealmList<E>>
Content copied to clipboard
KSerializer implementation for RealmList. Serialization is done as a generic list structure, whilst deserialization is done into an unmanaged RealmList.
It supports any serializable type as a type argument.
The serializer must be registered per property:
class Example : RealmObject {
@Serializable(RealmListKSerializer::class)
var myList: RealmList<String> = realmListOf()
}or per file:
@file:UseSerializers(RealmListKSerializer::class)
class Example : RealmObject {
var myList: RealmList<String> = realmListOf()
}
Adding the following code snippet to a Kotlin file would conveniently register any field using a Realm datatype to its correspondent serializer:
@file:UseSerializers(
RealmListKSerializer::class,
RealmSetKSerializer::class,
RealmAnyKSerializer::class,
RealmInstantKSerializer::class,
MutableRealmIntKSerializer::class,
RealmUUIDKSerializer::class
)
Serializers for all Realm data types can be found in
Constructors
RealmListKSerializer
Link copied to clipboard
Functions
Properties
descriptor
Link copied to clipboard